package com.tju.backend.oauth.config.abnormal;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.springframework.security.oauth2.common.exceptions.OAuth2Exception;

/**
 * 异常处理类
 *
 * @Author CLS
 * @Date 2021/12/30 14:47
 */
@JsonSerialize(using = AuthExceptionSerializer.class)
public class AuthException extends OAuth2Exception {
    private Integer status = 400;

    public AuthException(String message, Throwable t) {
        super(message, t);
        status = ((OAuth2Exception) t).getHttpErrorCode();
    }

    public AuthException(String message) {
        super(message);
    }

    @Override
    public int getHttpErrorCode() {
        return status;
    }

}
